
function Confirm-Companies {
    [CmdletBinding()]
    [OutputType([bool])]
    param (
        [Parameter(Mandatory = $false)][string[]]$Companies = @()
    )

    Write-Verbose "Asking user to confirm a list of $($Companies.Count) companies."
    
    # LS Insight needs to be set up for at least one company.
    if ($Companies.Count -eq 0) {
        return $false
    }

    # Write description.
    if ($Companies.Count -eq 1) {
        Write-Host "LS Insight will be set up for this company:"
    } else {
        Write-Host "LS Insight will be set up for these companies:"
    }

    # List down each company.
    foreach ($Company in $Companies) {
        Write-Host $Company
    }

    # Ask user to confirm
    return ((Read-Host -Prompt "Do you confirm? (y/n)") -iin @('y','yes'))
}